<?php 
class filemanager extends CI_Controller
{
	protected $_templates;
  
	public function __construct()
	{
        parent::__construct();
	  	$this->load->model('filemanager_model','filemanager');
		$this->load->library('icon_library') ;
	}
	
	function index()
	{
		$data['title'] = '';
		$config['base_url'] = base_url().'filemanager/index/'.$this->uri->segment(3);  
		$data['total'] = $this->filemanager->getNumFile();
		$config['total_rows']   =  $data['total'];
		$config['per_page']  	=   '10';
		$config['uri_segment'] 	= 4;   
		$this->pagination->initialize($config);   
		$data['list'] =   $this->filemanager->getAllFile($config['per_page'],(int)$this->uri->segment('4'));
		$data['pagination']    = $this->pagination->create_links();            
		$this->_templates['page'] = 'filemanager/index';
		$this->site->load($this->_templates['page'],$data,'basic');
	}
	  
	function upload()
	{
		$data['title'] = '';
		$this->_templates['page'] = 'filemanager/upload';
		$this->form_validation->set_rules('id','','');
		
		if($this->form_validation->run())
		{
			$file = $this->filemanager->upload();
			$data['file'] = $file;
		}
		$this->site->load($this->_templates['page'],$data,'basic');
	}
  
}
?>
